package cn.edu.xmu.oomall.comment.controller.vo;

import cn.edu.xmu.javaee.core.aop.CopyFrom;
import cn.edu.xmu.javaee.core.model.vo.IdNameTypeVo;
import cn.edu.xmu.oomall.comment.dao.bo.Comment;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * @author 谢传艳
 * @date 2024/12/8
 */
@NoArgsConstructor
@AllArgsConstructor
@Builder
@CopyFrom(Comment.class)
public class CommentVo {
    private Long id;
    private Long pid;
    private Byte type;
    private String content;
    private IdNameTypeVo creator;
    private IdNameTypeVo modifier;
    private Byte status;
    private Long productId;
    private LocalDateTime gmtCreate;
    private LocalDateTime gmtModified;

    public CommentVo(Comment comment) {
        this();
        this.setModifier(IdNameTypeVo.builder().id(comment.getModifierId()).name(comment.getModifierName()).build());
        this.setCreator(IdNameTypeVo.builder().id(comment.getCreatorId()).name(comment.getCreatorName()).build());
    }

    public Byte getStatus() {
        return status;
    }

    public void setStatus(Byte status) {
        this.status = status;
    }

    public IdNameTypeVo getCreator() {
        return creator;
    }

    public void setCreator(IdNameTypeVo creator) {
        this.creator = creator;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public void setType(Byte type) {
        this.type = type;
    }

    public Long getPid() {
        return pid;
    }

    public void setPid(Long pid) {
        this.pid = pid;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public Byte getType() {
        return type;
    }

    public Long getProductId() {
        return productId;
    }

    public void setProductId(Long productId) {
        this.productId = productId;
    }

    public LocalDateTime getGmtCreate() {
        return gmtCreate;
    }

    public void setGmtCreate(LocalDateTime gmtCreate) {
        this.gmtCreate = gmtCreate;
    }

    public IdNameTypeVo getModifier() {
        return modifier;
    }

    public void setModifier(IdNameTypeVo modifier) {
        this.modifier = modifier;
    }

    public LocalDateTime getGmtModified() {
        return gmtModified;
    }

    public void setGmtModified(LocalDateTime gmtModified) {
        this.gmtModified = gmtModified;
    }
}
